<template>
    <transition name="move">
        <div class="mine-venue-container" v-show="mineVenueFlag">
            <m-title :title="title" :returnShow="returnShow" @clickHide="hide"></m-title>
            <!-- content -->
            <scroll class="mine-venue-content" :data="venueList">
                <div>
                    <ul class="mine-venue-item">
                        <router-link :to="'/venueDetail/'+item.venueid" tag="li" class="mine-venue-list" v-for="(item, index) in venueList" :key="index">
                            <div class="left">
                                <img :src="item.coverimg" class="left-img" alt="" />
                            </div>
                            <div class="right">
                                <h4 class="right-title">{{item.venuename}}</h4>
                                <p class="right-address">{{item.address}}</p>
                                <p class="right-desc">{{item.content}}</p>
                            </div>
                            <div class="middle">
                                <span tag="span" class="train-order" v-if="item.status==='1'">预约成功</span>
                                <span tag="span" class="train-order" v-if="item.status==='-1'">待审核</span>
                            </div>
                        </router-link>
                    </ul> 
                </div>
            </scroll>
            <!-- 暂无场馆信息 -->
            <div class="mine-venue-none" v-show="venueList === null">
                <a href="javascript:;" class="mine-venue-none-btn"></a>
            </div>
        </div>
    </transition>
</template>

<script>
    import axios from 'axios'
    import MTitle from 'base/title/title'
    import Scroll from 'base/scroll/scroll'
    import Loading from 'base/loading/loading'
    export default {
        data () {
            return {
                title: '我的场馆',
                returnShow: true,
                mineVenueFlag: false,
                flag: false,
                venueList: [],
                detailList: {}
            }
        },
        methods: {
            show () {
                this.mineVenueFlag = true
            },
            hide () {
                this.mineVenueFlag = false
            },
            getVenueInfo () {
                axios.post('/api/index.php?g=Api&m=Ucenter&a=myvenue', {
                    openid: localStorage.getItem("openid"),
                    mid: localStorage.getItem("memberid")
                }).then((res) => {
                    // 请求成功
                    if (res.data.rescode === "0000") {
                        this.venueList = res.data.data
                    }
                }).catch(function (error) {
                    // 请求失败
                })
            }
        },
        components: {MTitle,Loading,Scroll},
        created() {
            this.getVenueInfo()
        }
    }
</script>

<style lang="stylus" scoped>
    @import '~common/stylus/mixins.styl'
    
    .mine-venue-container
        background: #fff
        width: 100%
        height: 100%
        position: fixed
        overflow: hidden
        top: 0
        left: 0
        padding-top: 10px
        box-sizing: border-box
        transition: all .2s linear
        &.move-enter,&.move-leave-to
            transform: translate3d(100%,0,0)
        .search
            width: 100%
            height: 44px
            background: #efeff4
            padding: 0 15px
            box-sizing: border-box
            -webkit-box-sizing: border-box
            position: relative
            overflow: hidden
            .searchInput
                width: 100%
                height: 32px
                background: #fff
                margin-top: 6px
                border: none
                border-radius: 0
                padding: 0 10px
                box-sizing: border-box
                -webkit-box-sizing: border-box
            .search-icon
                position: absolute
                background: url('./search-icon.png') no-repeat
                width: 13px
                height: 13px
                background-size: 100% 100%
                top: 16px
                left: 50%
                margin-left: -15px
            .searchPlaceHolder
                font-size: 14px
                color: #979797
                position: absolute
                top: 17px
                left: 51%
        .mine-venue-title
            width: 100%
            height: 40px
            position: absolute
            top: 60px
            display: flex
            align-items: center
            line-height: 40px
            border-top: 1px solid #eee
            border-bottom: 1px solid #eee
            box-sizing: border-box
            .item
                flex: 1
                text-align: center
                background: #fff
                height: 100%
                width: 100%
                box-sizing: border-box
                &.active
                    background: #0094d4
                    color: #fff
        .mine-venue-none
            position: absolute
            width: 100%
            top: 50%
            transform: translateY(-50%)
            z-index: 9
            .mine-venue-none-btn
                background: url('./icon1.png') no-repeat
                width: 212px
                height: 36px
                background-size: 100% 100%
                display: block
                margin: 0 auto
        .mine-venue-content
            position: absolute
            top: 50px
            background: #fff
            bottom: 0
            left: 0
            width: 100%
            padding: 0 15px
            box-sizing: border-box
            overflow: hidden
            .mine-venue-item
                width: 100%
                .mine-venue-list
                    width: 100%
                    height: 100px
                    border-bottom: 1px solid #eee
                    box-sizing: border-box
                    padding-top: 10px
                    display: flex
                    align-items: center
                    overflow: hidden
                    position: relative
                    .left
                        width: 100px
                        flex: 0 0 100px
                        .left-img
                            width: 100%
                    .right
                        flex: 1
                        margin-left: 10px
                        overflow: hidden
                        .right-title
                            font-size: 16px
                            color: #000
                        .right-address
                            font-size: 14px
                            color: #959595
                            margin-top: 4px
                            ellipsis()
                        .right-desc
                            font-size: 12px
                            color: #d1d1d1
                            margin-top: 2px
                            line-height: 150%
                    .middle
                        position: absolute
                        right: 0
                        top: 38px
                        .train-order
                            width: 66px
                            height: 24px
                            background: #0094d4
                            border-radius: 20px
                            color: #fff
                            display: block
                            text-align: center
                            line-height: 24px
                            font-size: 14px
</style>